#pragma once

#include <gl\glew.h>

#include <deque>
#include <map>
#include <set>

#include "entities\entity.h"

class Improvement:public Entity {
    public:
        Improvement();

        virtual void EndTurn();
        virtual void Select();
        virtual void Order(int target);
        virtual EntityType GetType(){ return ET_IMPROVEMENT; }

        bool IsConnectedByRoad(){ return connectedByRoad; }

        void SetConnectedByRoad(bool con){ connectedByRoad = con; }

        bool CanContainUnits();

        virtual void SetCityOwner(int id);

        virtual int GetTurnsToComplete();

        virtual std::string GetModelName();

        virtual bool IsConstructionPaused();
        virtual void SetConstructionPaused(bool pause);
        bool IsPrimaryBuildingComplete();

        virtual std::set<std::string> GetConstructionOptionNames();
        virtual std::set<std::string> GetImprovementOptionNames();

        float GetPopulationGrowthFactor();

        void DoBuildingConstruction();

        void AddBuilding(int id);
        void SetPrimaryBuildingID(int id){ primary_building_id = id; }
        int GetPrimaryBuildingID(){ return primary_building_id; }
        void AddBuildingToConstructionQueue(int id);
        void RemoveBuilding(int building);
        std::set<int> GetBuildingIDs(){ return buildings; }
        std::set<int> GetConstructionQueueIDs(){ return building_construction_queue; }

    protected:
        std::set<int> GetSelectedUnits();

        int primary_building_id;
        std::set<int> buildings;
        std::set<int> building_construction_queue;

        std::map<std::string,int> iVars;
        std::map<std::string,float> fVars;

        int production;
        float influence;

        bool besieged;
        bool connectedByRoad;
};
